package graph_viewer.util;

import java.io.*;

/**
	Provides print methods for this application.
	
	@author		Wanchun Li
	@author		paulur_sunceritfy@lycos.com
	@version	%I% %G%
 */
public final class Out {
	
	/**
		Prints the specified message.
	*/
	static public void print( String msg ){
		System.out.print( msg );
		
		try{
			File_Util.append_to_file( File_Util.log, msg );				
		}catch (IOException ioe){}
	}    
	
	/**
		Prints the specified message with a new line.
	*/
	static public void println( String msg ){
		print( msg +  "\n" );
	}
	
	/**
		Prints the specified error message.
	*/
	static public void printErr( String err ){		
		System.err.print( "\nERROR! " + err );
	}
	
	/**
		Prints the name of the instance that makes the error when excutes the doStuff job.
		
		@param	doStuff	the job to be done.
		@param	obje	the ojbect to do the job.
	*/
	static public void printErr( String doStuff, Object obj ){
		System.err.print( "\nERROR! Failed to " + doStuff + " in " + obj.getClass().getName() );
	}

	static public void threadPrint(String msg) {
		String name = Thread.currentThread().getName();
		System.out.println(name + ": " + msg);
	}
}///:~ end of Out